using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;

namespace MvcEngine.Mvc.UI
{
    public class FooterBuilder<T> : ICollection<GridFooter<T>> where T : class 
	{
        private readonly List<GridFooter<T>> _footers = new List<GridFooter<T>>();

        public IGridFooter<T> For(string value)
        {
            var footer = new GridFooter<T>(value);
            _footers.Add(footer);
            return footer;
        }

        public IEnumerator<GridFooter<T>> GetEnumerator()
		{
            return _footers.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

        void ICollection<GridFooter<T>>.Add(GridFooter<T> column)
		{
            _footers.Add(column);
		}

        void ICollection<GridFooter<T>>.Clear()
		{
            _footers.Clear();
		}

        bool ICollection<GridFooter<T>>.Contains(GridFooter<T> column)
		{
            return _footers.Contains(column);
		}

        void ICollection<GridFooter<T>>.CopyTo(GridFooter<T>[] array, int arrayIndex)
		{
            _footers.CopyTo(array, arrayIndex);
		}

        bool ICollection<GridFooter<T>>.Remove(GridFooter<T> column)
		{
            return _footers.Remove(column);
		}

        int ICollection<GridFooter<T>>.Count
		{
            get { return _footers.Count; }
		}

        bool ICollection<GridFooter<T>>.IsReadOnly
		{
			get { return false; }
		}
	}
}